Using bindings

The simplest of bindings include binding an object's property to a constant or to one of its own properties. Creating a more complex binding involves binding properties and attributes of one object to that of several different objects and adding several bindings.

You can create bindings after you add the Bindings property to an object. When creating bindings, note that:

See Reference for bindings expressions.

When you write expressions for bindings in the Binding Argument Editor, the fastest and most accurate way to include objects and their properties in the expression is to drag and drop them from the Properties to the Expression editor in the Binding Argument Editor.

Note that the properties you bind override the properties set in the Properties.

Creating a simple binding

The simplest of bindings include binding an object's property to a constant or to one of its own properties.

To create a binding:

  1. In the Project create and select an object the properties of which you want to bind.
    For example, create a Box object and select it.
  2. In the Properties add the Bindings property and click Add binding.
    The Binding Argument Editor window opens.
  3. In the Binding Argument Editor set the following:
  4. In the Expression editor enter the expression.
    For example:

Creating a more complex binding

A more complex binding involves binding properties of one object to that of several objects, or using several bindings. In this example, you create three sliders, each regulating one of the three light colors.

To create a more complex binding:

  1. Create three Slider objects and a Spot Light. See Using sliders.
  2. Select the Spot Light, in the Properties add the Bindings property and click Add binding.
    The Binding Argument Editor window opens.
  3. In the Binding Argument Editor set:Click Save.
  4. Repeat the previous step for the Spot Light Color attributes Color G and Color B, and bind them to the Slider Value property of Slider objects Slider_Green and Slider_Blue.
    Move the knobs of the sliders to change the color of the Spot Light.

Animating using bindings

You can use bindings for animations. One of the main advantages of using bindings to animate objects is that instead of time, you can use an object property.

To animate objects using bindings:

  1. Create an animation. See Animations.
  2. In the Project select the object you want to animate, in the Properties click Add Properties, and add the Bindings property.
  3. In the Properties click Add binding and set in the Binding Argument Editor:
  4. Click Save.

Using bindings as an alternative to property inheritance

You can use bindings as an alternative to inheritance. You can use inheritance for defining a property in a parent so that it is inherited by a child object, but it works only when a property is inheritable and it is acceptable to have the property inherited by all child objects. See Property system.

To use bindings as an alternative to inheritance:

  1. Create a custom property and add it to the object to which you want to create a binding.
  2. Select the object to which you want to add a binding, in the Properties click Add Properties, and add the Bindings property.
  3. In the Properties click Add binding and set in the Binding Argument Editor:
    1. Property and Attribute to the property and attribute you want to bind.
    2. In the Expression editor enter the expression to include the custom property you created in the beginning of this procedure.
    Click Save.

See also

Reference for bindings expressions

Bindings